home *** CD-ROM | disk | FTP | other *** search
/ Your Choice 1 / your choice.zip / your choice / PRGMMING / RASTERS / RASTERS.PAS < prev   
Pascal/Delphi Source File  |  1994-01-07  |  8KB  |  254 lines

  1. Program Rasters;
  2.  
  3. Uses Crt;
  4.  
  5. Const MaxRasters = 895;
  6.  
  7. Var Rastercolors : Array[0..MaxRasters,1..3] Of Byte;
  8.     Teller       : Integer;
  9.     ByteTeller   : Integer;
  10.     ColorTeller  : Integer;
  11.     Speed        : Integer;
  12.     ValCode      : Integer;
  13.     Ch           : Char;
  14.  
  15. Label Loop;
  16.  
  17. {---------------------------------------------------------------------------}
  18.  
  19. Procedure Title;
  20.  
  21. { Just to show a title... }
  22.  
  23. Begin
  24.      Writeln;
  25.      Writeln('Rasterbars v1.0 by Eric van der Staay - Rasters /h for help!');
  26.      Writeln;
  27. End;
  28.  
  29. {---------------------------------------------------------------------------}
  30.  
  31. Begin
  32.      Delay(100);
  33.  
  34.      {---[ Initialise default bar-speed (going down with speed 1) ]---}
  35.  
  36.      Speed:=-1;
  37.  
  38.      {---[ Determine if parameters are given ]---}
  39.  
  40.      If ParamCount>0 Then
  41.      Begin
  42.           {---[ Help! ]---}
  43.  
  44.           If (ParamStr(1)='/h') Or
  45.              (ParamStr(1)='/H') Or
  46.              (ParamStr(1)='/?') Then
  47.           Begin
  48.                Title;
  49.                Writeln('Syntax...: Rasters [Speed]');
  50.                Writeln('Example..: Rasters 3     - Goes up with a speed of 3');
  51.                Writeln('           Rasters -2    - Goes down with a speed of 2');
  52.                Writeln;
  53.                Writeln('You can use this for a background of an ansi... ');
  54.                Writeln('Just show the ansi first and then run this program!');
  55.                Writeln;
  56.                Writeln('If you want a nice advertisement for your BBS or you want me to code a crack');
  57.                Writeln('intro for you or your group, then write to:');
  58.                Writeln;
  59.                Writeln('     Eric van der Staay');
  60.                Writeln('     IJweg 133a');
  61.                Writeln('     1161 EV  Zwanenburg');
  62.                Writeln('     Hollland');
  63.                Writeln('     ++31(0)2907-2039');
  64.                Writeln;
  65.                Writeln('If you''re into Assembler and Pascal source swapping, don''t hesitate to write!');
  66.                Writeln;
  67.                Halt(1);
  68.           End;
  69.  
  70.           {---[ Speed as parameter ]---}
  71.  
  72.           Val(ParamStr(1),Speed,ValCode);
  73.           If ValCode<>0 Then
  74.           Begin
  75.                {---[ Hey! Illegal speeds! ]---}
  76.  
  77.                Title;
  78.                Writeln('Illegal bar speed!');
  79.                Writeln;
  80.                Halt(1);
  81.           End;
  82.      End;
  83.  
  84.      {---[ Disable interrupts for smooth scrolling bars... ]---}
  85.  
  86.      Port[$21]:=1;
  87.  
  88.      {---[ ColorCounter (Teller=Counter in Dutch) ]---}
  89.  
  90.      ColorTeller:=0;
  91.  
  92.      {---[ *** Initialise different colorbars *** ]---}
  93.  
  94.      {---[ Bar 1 (Red) ]---}
  95.  
  96.      For ByteTeller:=0 To 63 Do
  97.      Begin
  98.           RasterColors[ColorTeller,1]:=ByteTeller;
  99.           RasterColors[ColorTeller,2]:=0;
  100.           RasterColors[ColorTeller,3]:=0;
  101.           ColorTeller:=ColorTeller+1;
  102.      End;
  103.      For ByteTeller:=63 DownTo 0 Do
  104.      Begin
  105.           RasterColors[ColorTeller,1]:=ByteTeller;
  106.           RasterColors[ColorTeller,2]:=0;
  107.           RasterColors[ColorTeller,3]:=0;
  108.           ColorTeller:=ColorTeller+1;
  109.      End;
  110.  
  111.      {---[ Bar 2 (Green) ]---}
  112.  
  113.      For ByteTeller:=0 To 63 Do
  114.      Begin
  115.           RasterColors[ColorTeller,1]:=0;
  116.           RasterColors[ColorTeller,2]:=ByteTeller;
  117.           RasterColors[ColorTeller,3]:=0;
  118.           ColorTeller:=ColorTeller+1;
  119.      End;
  120.      For ByteTeller:=63 DownTo 0 Do
  121.      Begin
  122.           RasterColors[ColorTeller,1]:=0;
  123.           RasterColors[ColorTeller,2]:=ByteTeller;
  124.           RasterColors[ColorTeller,3]:=0;
  125.           ColorTeller:=ColorTeller+1;
  126.      End;
  127.  
  128.      {---[ Bar 3 (Blue) ]---}
  129.  
  130.      For ByteTeller:=0 To 63 Do
  131.      Begin
  132.           RasterColors[ColorTeller,1]:=0;
  133.           RasterColors[ColorTeller,2]:=0;
  134.           RasterColors[ColorTeller,3]:=ByteTeller;
  135.           ColorTeller:=ColorTeller+1;
  136.      End;
  137.      For ByteTeller:=63 DownTo 0 Do
  138.      Begin
  139.           RasterColors[ColorTeller,1]:=0;
  140.           RasterColors[ColorTeller,2]:=0;
  141.           RasterColors[ColorTeller,3]:=ByteTeller;
  142.           ColorTeller:=ColorTeller+1;
  143.      End;
  144.  
  145.      {---[ Bar 4 (Yellow) ]---}
  146.  
  147.      For ByteTeller:=0 To 63 Do
  148.      Begin
  149.           RasterColors[ColorTeller,1]:=ByteTeller;
  150.           RasterColors[ColorTeller,2]:=ByteTeller;
  151.           RasterColors[ColorTeller,3]:=0;
  152.           ColorTeller:=ColorTeller+1;
  153.      End;
  154.      For ByteTeller:=63 DownTo 0 Do
  155.      Begin
  156.           RasterColors[ColorTeller,1]:=ByteTeller;
  157.           RasterColors[ColorTeller,2]:=ByteTeller;
  158.           RasterColors[ColorTeller,3]:=0;
  159.           ColorTeller:=ColorTeller+1;
  160.      End;
  161.  
  162.      {---[ Bar 5 (Purple) ]---}
  163.  
  164.      For ByteTeller:=0 To 63 Do
  165.      Begin
  166.           RasterColors[ColorTeller,1]:=ByteTeller;
  167.           RasterColors[ColorTeller,2]:=0;
  168.           RasterColors[ColorTeller,3]:=ByteTeller;
  169.           ColorTeller:=ColorTeller+1;
  170.      End;
  171.      For ByteTeller:=63 DownTo 0 Do
  172.      Begin
  173.           RasterColors[ColorTeller,1]:=ByteTeller;
  174.           RasterColors[ColorTeller,2]:=0;
  175.           RasterColors[ColorTeller,3]:=ByteTeller;
  176.           ColorTeller:=ColorTeller+1;
  177.      End;
  178.  
  179.      {---[ Bar 6 (Light-Blue) ]---}
  180.  
  181.      For ByteTeller:=0 To 63 Do
  182.      Begin
  183.           RasterColors[ColorTeller,1]:=0;
  184.           RasterColors[ColorTeller,2]:=ByteTeller;
  185.           RasterColors[ColorTeller,3]:=ByteTeller;
  186.           ColorTeller:=ColorTeller+1;
  187.      End;
  188.      For ByteTeller:=63 DownTo 0 Do
  189.      Begin
  190.           RasterColors[ColorTeller,1]:=0;
  191.           RasterColors[ColorTeller,2]:=ByteTeller;
  192.           RasterColors[ColorTeller,3]:=ByteTeller;
  193.           ColorTeller:=ColorTeller+1;
  194.      End;
  195.  
  196.      {---[ Bar 7 (White) ]---}
  197.  
  198.      For ByteTeller:=0 To 63 Do
  199.      Begin
  200.           RasterColors[ColorTeller,1]:=ByteTeller;
  201.           RasterColors[ColorTeller,2]:=ByteTeller;
  202.           RasterColors[ColorTeller,3]:=ByteTeller;
  203.           ColorTeller:=ColorTeller+1;
  204.      End;
  205.      For ByteTeller:=63 DownTo 0 Do
  206.      Begin
  207.           RasterColors[ColorTeller,1]:=ByteTeller;
  208.           RasterColors[ColorTeller,2]:=ByteTeller;
  209.           RasterColors[ColorTeller,3]:=ByteTeller;
  210.           ColorTeller:=ColorTeller+1;
  211.      End;
  212.  
  213.      {---[ Bytecounter for colorcounter step -> makes scrolling bars ]---}
  214.  
  215.      ByteTeller:=0;
  216.  
  217.      Repeat
  218.            {---[ Start of rastercolors array ]---}
  219.  
  220.            ColorTeller:=ByteTeller;
  221.  
  222. Loop:      Port[$3c8]:=0;                            { Color 0 (Background) }
  223.            Port[$3c9]:=RasterColors[ColorTeller,1];       { Init colors RGB }
  224.            Port[$3c9]:=RasterColors[ColorTeller,2];
  225.            Port[$3c9]:=RasterColors[ColorTeller,3];
  226.  
  227.            Inc(ColorTeller);                          { Increase colorcount }
  228.            If ColorTeller>MaxRasters Then ColorTeller:=0;           { Limit }
  229.  
  230.            {---[ Check last scanline ]---}
  231.  
  232.            Asm
  233.               Mov Dx,$3DA
  234.  
  235.               In Al,Dx
  236.               Test Al,8
  237.               Jz Loop                                { Zero (JZ)? Jump loop }
  238.            End;
  239.  
  240.            {---[ Not Zero (vertical retrace) ]---}
  241.  
  242.            ByteTeller:=ByteTeller+Speed;                    { For scrolling }
  243.            If ByteTeller>MaxRasters Then ByteTeller:=0;            { Limits }
  244.            If ByteTeller<0 Then ByteTeller:=MaxRasters;
  245.  
  246.      Until Port[$60]<$80;
  247.  
  248.      Port[$3c8]:=0;                           { Original (black) background }
  249.      Port[$3c9]:=0;
  250.      Port[$3c9]:=0;
  251.      Port[$3c9]:=0;
  252.  
  253.      Port[$21]:=0;                                      { Enable interrupts }
  254. End.